<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<form action="${pageContext.request.contextPath}/loginServlet?method=login" method="post">
		用户名：<input type="text" name="name"/><br/>
		密码：<input type="password" name="password"/><br/>
		验证码: <input  type="text" name="checkCode"/>
		<img id="checkCode"  src="${pageContext.request.contextPath}/checkCode" onclick="refreshCode()"><br/>
		<input type="submit" value="登录"/>
	</form>
	
	
	 <script src="js/jquery.min.js"></script>
	<script type="text/javascript">
		function refreshCode() {
			// 点击图片之后重新去请求一张新的验证码赋给src这个属性
			$("#checkCode").attr("src", "${pageContext.request.contextPath}/checkCode?" + Math.random());
		}
	</script>
</body>
</html>